#include <iostream>
#include <string.h>
using namespace std;

class Building;
class Goodgay{
public:
    Goodgay();
    void visit();//参观函数 访问Building中的属性
    Building *building;
};

class Building{
    friend class Goodgay;
public:
    Building();
public:
    string m_SittingRoom;
private:
    string m_BedRoom;
};

//类外写成员函数
Building::Building(){
    m_SittingRoom = "客厅";
    m_BedRoom = "卧室";
}

Goodgay::Goodgay(){
    //创建建筑物对象
    building = new Building;
}

void Goodgay::visit(){
    cout << "好基友正在访问：" << building->m_SittingRoom << endl;
    cout << "好基友正在访问：" << building->m_BedRoom << endl;
}
void test01(){
    Goodgay gg;
    gg.visit();
}
int main(){
    test01();
	system("pause");
	return 0;
}

